<?PHP

	class tpl_usercp {
		
		public static function printmenu($data,$section){
			
			$menu_html = '';
			foreach($data as $menu_header=>$menu_data){
				
				$menu_html .= "<div class='menu_container'><div class='menu_title'>$menu_header</div>";
				foreach($menu_data as $menu_item=>$menu_url){
					
					if($section != $menu_url){
						$classes = " class='menu_item_n' onmouseover=\"this.className='menu_item_o'\" onmouseout=\"this.className='menu_item_n'\"";
					}else{
						$classes = " class='menu_item_o'";
					}
					
					$menu_html .= "<div $classes onclick=\"document.location='./index.php?act=usersettings{$GLOBALS['OUTPUT']->ses}&section=$menu_url'\">$menu_item</div>";
				}
				$menu_html .= "</div><br />";
				
			}
			
			return<<<EOV
<style type='text/css'>
	.menu_container {
		border: 1px solid #909397;
		background: white;
		width: 195px;
		padding: 1px;
	}

	.menu_title {
		background: url(./themes/default/images/table_header_bg.png);
		height: 20px;
		font-weight: bold;
		font-size: 14px;
		padding: 5px;
		text-align: center;
	}

	.menu_item_n, .menu_item_o {
		background: #E2E7EA;
		border-top: 1px solid white;
		padding: 5px;
		cursor: pointer;
		color: #24517F;
	}

	.menu_item_o {
		background: #4091E4;
		color: white;
	}
</style>
$menu_html
EOV;
		}
		
		public static function header(){
			
			$menu = tpl_usercp::printmenu($GLOBALS['OUTPUT']->cpmenu,$GLOBALS['OUTPUT']->cpsection);
			
			return <<<EOV
<div style='float: left; width: 197px; margin-right: 15px;'>
		{$menu}
</div>
<div style='float: left; width: 425px;'>
EOV;
		}
		
		public static function footer(){
			return <<<EOV
</div>
EOV;
		}
	
		public static function buddylist_disabled(){
			return tpl_usercp::access_denied($GLOBALS['LANG']->lang_usermgmt->cannot_use_buddylist);
		}
		
		public static function access_denied($message){
			return	tpl_globals::header() .
				tpl_globals::global_styles_shared() .
				tpl_globals::inner_global_styles() .
				tpl_globals::form_styles2() .
				tpl_usercp::header() .
				<<<EOV
<div style='width: 400px; margin: auto;'>
	<div class='form_container'><div class='row title'>{$GLOBALS['LANG']->lang_formcommon->information}</div><div class='row start'>{$message}</div></div><br />
</div>
EOV;
		}
		
		public static function profile_form($form){
					
			$form_html = tpl_form::printform($form);
			$submit = tpl_form::submitbutton($GLOBALS['LANG']->lang_misc->submit);
			
			return	tpl_globals::header() .
				tpl_globals::global_styles_shared() .
				tpl_globals::inner_global_styles() .
				tpl_globals::form_styles2() .
				tpl_usercp::header() .
				<<<EOV
<div style='width: 400px; margin: auto;'>
	<form action='./index.php?act=usersettings{$GLOBALS['OUTPUT']->ses}&section=profile' method='post' accept-charset='UTF-8'>
	{$form_html}
	<div class='form_container'>
		<div class='row end'>
			{$submit}
		</div>
	</div>
	</form>
</div>
EOV
.
				tpl_usercp::footer() .
				tpl_globals::footer(false);
		}
		
		public static function settings_form($form){
			
			$form_html = tpl_form::printform($form);
			$submit = tpl_form::submitbutton($GLOBALS['LANG']->lang_misc->submit);
			
			return	tpl_globals::header() .
				tpl_globals::global_styles_shared() .
				tpl_globals::inner_global_styles() .
				tpl_globals::form_styles2() .
				tpl_usercp::header() .
				<<<EOV
<div style='width: 400px; margin: auto;'>
	<form action='./index.php?act=usersettings{$GLOBALS['OUTPUT']->ses}&section=general' method='post' accept-charset='UTF-8'>
	{$form_html}
	<div class='form_container'>
		<div class='row end'>
			{$submit}
		</div>
	</div>
	</form>
</div>
EOV
.
				tpl_usercp::footer() .
				tpl_globals::footer(false);
		}
		
		public static function buddylist($form,$list){
			
			$form_html = tpl_form::printform($form);
			$submit = tpl_form::submitbutton($GLOBALS['LANG']->lang_misc->submit);
			
			$message = '';
			if(isset($GLOBALS['OUTPUT']->message))
				$message = "<div class='form_container'><div class='row title'>{$GLOBALS['LANG']->lang_formcommon->information}</div><div class='row start'>{$GLOBALS['OUTPUT']->message}</div></div><br />";
			
			$listtext = '';
			if(empty($list)){
				$listtext .= "<div style='text-align: center'><i>{$GLOBALS['LANG']->lang_usermgmt->list_empty}</i></div>";
			}else{
				foreach($list as $uid=>$uname){
					$listtext .= "<a href='./index.php?act=usersettings{$GLOBALS['OUTPUT']->ses}&section=buddylist&remove={$uid}'>{$uname}</a><br />";
				}
			}
			
			return	tpl_globals::header() .
				tpl_globals::global_styles_shared() .
				tpl_globals::inner_global_styles() .
				tpl_globals::form_styles2() .
				tpl_usercp::header() .
				<<<EOV
<div style='width: 400px; margin: auto;'>
	{$message}
	<div class='form_container'>
		<div class='row title'>{$GLOBALS['LANG']->lang_usermgmt->ucp_buddylist}</div>
		<div class='row start'>{$GLOBALS['LANG']->lang_usermgmt->buddylist_instructions}</div>
		<div class='row even'>{$listtext}</div>
	</div>
	<br />
	<form action='./index.php?act=usersettings{$GLOBALS['OUTPUT']->ses}&section=buddylist' method='post' accept-charset='UTF-8'>
	{$form_html}
	<div class='form_container'>
		<div class='row end'>
			{$submit}
		</div>
	</div>
	</form>
</div>
EOV
.
				tpl_usercp::footer() .
				tpl_globals::footer(false);
		}
		
		public static function ignorelist($form,$list){
			
			$form_html = tpl_form::printform($form);
			$submit = tpl_form::submitbutton($GLOBALS['LANG']->lang_misc->submit);
			
			$message = '';
			if(isset($GLOBALS['OUTPUT']->message))
				$message = "<div class='form_container'><div class='row title'>{$GLOBALS['LANG']->lang_formcommon->information}</div><div class='row start'>{$GLOBALS['OUTPUT']->message}</div></div><br />";
			
			$listtext = '';
			if(empty($list)){
				$listtext .= "<div style='text-align: center'><i>{$GLOBALS['LANG']->lang_usermgmt->list_empty}</i></div>";
			}else{
				foreach($list as $uid=>$uname){
					$listtext .= "<a href='./index.php?act=usersettings{$GLOBALS['OUTPUT']->ses}&section=ignorelist&remove={$uid}'>{$uname}</a><br />";
				}
			}
			
			return	tpl_globals::header() .
				tpl_globals::global_styles_shared() .
				tpl_globals::inner_global_styles() .
				tpl_globals::form_styles2() .
				tpl_usercp::header() .
				<<<EOV
<div style='width: 400px; margin: auto;'>
	{$message}
	<div class='form_container'>
		<div class='row title'>{$GLOBALS['LANG']->lang_usermgmt->ucp_ignorelist}</div>
		<div class='row start'>{$GLOBALS['LANG']->lang_usermgmt->ignorelist_instructions}</div>
		<div class='row even'>{$listtext}</div>
	</div>
	<br />
	<form action='./index.php?act=usersettings{$GLOBALS['OUTPUT']->ses}&section=ignorelist' method='post' accept-charset='UTF-8'>
	{$form_html}
	<div class='form_container'>
		<div class='row end'>
			{$submit}
		</div>
	</div>
	</form>
</div>
EOV
.
				tpl_usercp::footer() .
				tpl_globals::footer(false);
		}
	}

?>